import { createRouter, createWebHistory } from 'vue-router'

const routes = [
  {
    path: '/main',
    name: 'main',
    component: () => import('../views/Main.vue'),
    children: [
      {
        path: '/',
        name: 'shoppingMall',
        component: () => import('../views/ShoppingMall.vue')
      },
      {
        path: '/categoryList',
        name: 'categoryList',
        component: () => import('../views/CategoryList.vue')
      },
      {
        path: '/cart',
        name: 'cart',
        component: () => import('../views/Cart.vue')
      },
      {
        path: '/usercenter',
        name: 'usercenter',
        component: () => import('../views/UserCenter.vue')
      }
    ]
  },

  {
    path: '/register',
    name: 'register',
    component: () => import('../views/Register.vue')
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/Login.vue')
  },
  {
    path: '/goods',
    name: 'goods',
    component: () => import('../views/Goods.vue')
  }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
